<?php include PATH_TPL."/tpl_header.html" ?>
<script type="text/javascript" src="/public/js/admin/updateCourse.js"></script>

<div class="header">
    <h1 class="page-title">课程管理</h1>
</div>
        
<ul class="breadcrumb">
    <li><a>课程管理</a> <span class="divider">/</span></li>
    <li><a href="<?php echo SITE_ROOT;?>admin/show-courses">所有课程</a> <span class="divider">/</span></li>
    <li class="active">修改课程信息</li>
</ul>

<div class="container-fluid">
    <div class="row-fluid">
        <div class="well">
          <ul class="nav nav-tabs">
            <li class="active"><a href="#home" data-toggle="tab">基本信息</a></li>
          </ul>
          <div id="myTabContent" class="tab-content">
            <div class="tab-pane active in" id="home">
              <form id="tab">
                  <div class="errMsg commonMsg"></div>
                  <div class="errMsg errMsgCourseId"></div>
                  <label for="courseId">*课程号</label>
                  <input type="text" placeholder="课程号" class="input-xlarge" id="courseId" value="<?php echo $course['course_id'];?>" readonly>

                  <div class="errMsg errMsgCourseName"></div>
                  <label for="courseName">*课程名称</label>
                  <input type="text" placeholder="课程名称" class="input-xlarge" id="courseName" value="<?php echo $course['coursename'];?>">

                  <label for="description">课程描述</label>
                  <textarea id="description" cols="150" rows="3"><?php echo $course['course_description'] ?></textarea>

                  <div class="errMsg errMsgTerm"></div>
                  <label for="term">*学期</label>
                  <select id="term">
                      <?php foreach($term as $k=>$v){ ?>
                      <option value="<?php echo $k?>" <?php if($k==$course['term']) echo "selected"; ?>><?php echo $v?></option>
                      <?php }?>
                  </select>
                  
                  <div class="errMsg errMsgCredit"></div>
                  <label for="credit">*学分</label>
                  <input type="text" placeholder="学分" class="input-xlarge" id="credit" value="<?php echo $course['credit'];?>">
                  
                  <div class="errMsg errMsgHours"></div>
                  <label for="hours">*课时</label>
                  <input type="text" placeholder="课时" class="input-xlarge" id="hours" value="<?php echo $course['hours'];?>">
                  
                  <div class="errMsg errMsgPlimit"></div>
                  <label for="plimit">*限选人数</label>
                  <input type="text" placeholder="限选人数" class="input-xlarge" id="plimit" value="<?php echo $course['plimit'];?>">
                  
                  <label for="tid">任课教师</label>
                  <select id="tid">
                      <?php foreach($allTeacher as $teacher){ ?>
                      <option value="<?php echo $teacher['uid']?>" <?php if($teacher['uid']==$course['tid']) echo "selected"; ?>>
                        <?php echo $teacher['name']?>
                      </option>
                      <?php }?>
                  </select>

                  <label for="active">*课程状态</label>
                  <select id="active">
                      <?php foreach($active as $k=>$v){ ?>
                      <option value="<?php echo $k?>" <?php if($k==$course['active']) echo "selected"; ?>><?php echo $v?></option>
                      <?php }?>
                  </select>

                  <label for="major">*所属专业</label>
                  <select id="major">
                      <?php foreach($allMajor as $major){ ?>
                      <option value="<?php echo $major['major_id']?>" <?php if($major['major_id']==$course['major_id']) echo "selected"; ?>><?php echo $major['majorname']?></option>
                      <?php }?>
                  </select>
              </form>
            </div>
        </div>
        <div class="btn-toolbar">
            <button class="btn btn-primary" id="submit"><i class="icon-save"></i>保存</button>
            <div class="btn-group"></div>
        </div>
    </div>
</div>


<?php include PATH_TPL."/tpl_sidebar.html" ?>